﻿@model Authentication.Model.ViewModel.Account.ProfileViewModel
<ul class="breadcrumb">
    <li>
        <i class="icon-group"></i>
        <a href="/">Account</a>
        <i class="icon-angle-right"></i>
    </li>
    <li>
        <i class="icon-edit"></i>
        <a href="#">Profile</a>
    </li>
</ul>
<!--/span-->
<div class="row-fluid">
    <div class="box span12 yellow">
        <div class="box-header">
            <h2><i class="halflings-icon hand-top"></i><span class="break"></span>@Html.Raw(string.Format("{0}'s sumary", Model.FullName))</h2>
        </div>
        <div class="box-content">
            <a class="quick-button-small span1">
                <i class="icon-group"></i>
                <p>Users</p>
                <span class="notification blue">7</span>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-comments-alt"></i>
                <p>Comments</p>
                <span class="notification green">4</span>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-shopping-cart"></i>
                <p>Orders</p>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-barcode"></i>
                <p>Products</p>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-envelope"></i>
                <p>Messages</p>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-calendar"></i>
                <p>Calendar</p>
                <span class="notification red">8</span>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-beaker"></i>
                <p>Projects</p>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-thumbs-up"></i>
                <p>Likes</p>
                <span class="notification green">1</span>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-heart-empty"></i>
                <p>Favorites</p>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-bullhorn"></i>
                <p>Notifications</p>
                <span class="notification yellow">7</span>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-cogs"></i>
                <p>Settings</p>
            </a>
            <a class="quick-button-small span1">
                <i class="icon-dashboard"></i>
                <p>Dashboard</p>
            </a>

            <div class="clearfix"></div>
        </div>
    </div>
    <!--/span-->
</div>
<!--/span-->
<div class="row-fluid">
    <div class="box span9">
        <div class="box-header">
            <h2><i class="halflings-icon list"></i><span class="break"></span>@Html.Raw(string.Format("{0}'s profile", Model.FullName))</h2>
        </div>
        <div class="box-content">
            <div class="validation-summary alert alert-error">
                <a class="close" data-dismiss="alert">×</a>
                <h5 class="alert-heading">Reset validate</h5>
                @Html.AntiForgeryToken()
                @Html.ValidationSummary()
            </div>
            <div class="quick-button metro span2">
                <i class="icon-none">
                    <img class="grayscale" alt="andrew nguyen" src="/Content/img/unknow_avatar.png" width="100">
                </i>
            </div>
            <!--/span-->
            <dl class="span10">
                <dt>General information</dt>
                <dd>First name: @Model.FirstName</dd>
                <dd>Last name: @Model.LastName</dd>
                <dd><i>Full name: @Model.FullName</i></dd>
                <dd>Date of birth: @Model.Birthday</dd>
                <dd>Gender: @Model.Gender</dd>
            </dl>
            <!--/span-->
            <dl class="span12">
                <dt>Contact information</dt>
                <dd>Phone: @Model.Mobile</dd>
                <dd>Email: @Model.Email</dd>
                <dd>Address: @Model.Address</dd>
            </dl>
            <!--/span-->
            <dl class="span12">
                <dt>Additional information</dt>
                <dd>Group: @Model.GroupName</dd>
                <dd>Active: @Model.Active</dd>
            </dl>
            <!--/span-->
            <div class="clearfix"></div>
            <div class="form-actions">
                <button id="btnEditProfile" class="btn btn-success">Edit Profile</button>
                @if (Model.UserName.ToUpper() != Authentication.Configuration.SystemConfiguration.SUPPER_ADMIN)
                {
                    <a href="/account/changegroup" class="btn btn-success">Change group</a>
                    <a href="/account/assign" class="btn btn-success">Assign Function</a>
                }
            </div>
        </div>
    </div>
    <!--/span-->

    <div class="box span3 brown">
        <div class="box-header">
            <h2><i class="halflings-icon white user"></i><span class="break"></span>Account</h2>
        </div>
        <div class="box-content">
            <ul class="dashboard-list">
                <li>
                    <a href="#">
                        <img class="avatar" alt="andrew nguyen" src="/Content/img/unknow_avatar.png">
                    </a>
                    <strong>Name:</strong> @Model.FullName<br>
                    <strong>Since:</strong> @Model.CreationDate<br>
                    <strong>Status:</strong> @(Model.Active ? "Approved" : "Not Approved")
                </li>
            </ul>
        </div>
    </div>
    <!--/span-->

    <div class=" span3 box blue">
        <div class="box-header">
            <h2><i class="halflings-icon white lock"></i><span class="break"></span>Permission</h2>
        </div>
        <div class="box-content">
            <ul class="dashboard-list metro" style="overflow-y: auto; max-height: 130px;">
                <li>
                    <a>
                        <i class="icon-group green"></i>
                        <strong>Group:</strong>
                        @Model.GroupName
                    </a>
                </li>
                <li>
                    <a>
                        <i class="icon-list red"></i>
                        <strong>Functions</strong>
                    </a>
                </li>
                @for (int i = 0; i < Model.Objects.Count; i++)
                {
                    <li>
                        <a>
                            <i class="icon-list red"></i>
                            <strong>@(i + 1)</strong>
                            @Model.Objects[i].ObjectName
                        </a>
                    </li>
                }
            </ul>
        </div>
    </div>
    <!--/span-->

    <div class="box span3">
        <div class="box-header">
            <h2><i class="halflings-icon white list"></i><span class="break"></span>Reset password</h2>
        </div>
        <div class="box-content">
            @using (Html.BeginForm("Reset", "Account", FormMethod.Post))
            {
                <div class="control-group">
                    @Html.LabelFor(m => m.Email, new { @class = "control-label" })
                    <div class="controls">
                        <div class="input-append">
                            @Html.TextBox("Email2Reset", Model.Email, new { @class = "span8" })
                            <input class="btn btn-small btn-warning span5" type="submit" value="Reset" />
                        </div>
                    </div>
                </div>
            }
        </div>
    </div>
    <!--/span-->
</div>

@*Check permission*@
@if (true)
{
    <div id="profileEditor" class="modal fade box brown">
        <div class="box-header">
            <h2><i class="halflings-icon white list"></i><span class="break"></span>Profile Confirmation</h2>
            <div class="box-icon">
                <a data-dismiss="modal" class="close"><i class="halflings-icon white remove"></i></a>
            </div>
        </div>
        <div class="box-content">
            @using (Html.BeginForm("Profile", "Account", FormMethod.Post, new { @class = "form-horizontal", name = "Update", id = "Update" }))
            {
                <fieldset>
                    <div class="control-group">
                        @Html.LabelFor(m => m.FirstName, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(m => m.FirstName)
                        </div>
                    </div>
                    <div class="control-group">
                        @Html.LabelFor(m => m.LastName, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(m => m.LastName)
                        </div>
                    </div>
                    <div class="control-group">
                        @Html.LabelFor(m => m.Email, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(m => m.Email)
                        </div>
                    </div>
                    <div class="control-group">
                        @Html.LabelFor(m => m.Mobile, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(m => m.Mobile)
                        </div>
                    </div>
                    <div class="control-group">
                        @Html.LabelFor(m => m.Birthday, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(m => m.Birthday, new { @class = "datemask" })
                        </div>
                    </div>
                    <div class="control-group">
                        @Html.LabelFor(m => m.Gender, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextBoxFor(m => m.Gender)
                        </div>
                    </div>

                    <div class="control-group">
                        @Html.LabelFor(m => m.Address, new { @class = "control-label" })
                        <div class="controls">
                            @Html.TextAreaFor(m => m.Address, new {/* @class = "cleditor",*/ rows = 3 })
                        </div>
                    </div>
                    <div class="form-actions modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <input type="submit" name="btnUpdate" id="btnUpdate" class="btn btn-primary" value="Save changes" />
                    </div>
                </fieldset>
            }
        </div>
    </div>
}

@section scripts
{
    @*Check permission*@
    @if (true)
    {
        <script type="text/javascript">
            $("#btnEditProfile").click(function () {
                $("#profileEditor").modal('show');
            });
        </script>
    }
}